<!DOCTYPE html>
<html>

<div th:replace="common/jsCssRef :: jsfJsCssRef"></div>
<body class="bgf6">

	<div th:replace="common/head :: jsfHeader"></div>
	
	<div class="main-body pb100">
		<div class="container pt10">
			<div class="dflx sbt">
				<div th:replace="common/left :: jsfLeft"></div>
				
				<div class="body-right">
					<div class="bread-nav bgff">
						<ul class="dflx">
							<li><a href="###">首页</a></li>
							<li><a href="###">统筹规划</a></li>
							<li><a href="/view/specialPlan">专项发展规划</a></li>
							<li><a href="###">查看</a></li>
						</ul>
					</div>
					
					<div class="bgff mt10 pb20" id="app">
						<div class="wrap">
							<div class="top-info">
								<h2 class="title">{{plan.planName}}<span class="no" v-text="plan.planNo"></span></h2>
								<div class="mt5">
									<span>创建人：{{plan.creatorJfid}}</span>
									<span class="ml20">创建时间：{{plan.createTime}}</span>
								</div>
								<div class="edit tr">
									<p class="org">{{planStatusDesc(plan.currentState)}}</p>
								</div>
							</div>
							
                            <div class="box mt30">
                            	<div class="box-title"><span>编制专项规划基本信息</span></div>
                            	<div class="mt20 f14">
                            		<div class="two">
                            			<span class="title">规划名称</span>
	                					<span class="content" v-text="plan.planName"></span>
	                        			<span class="title">规划编号</span>
	                					<span class="content" v-text="plan.planNo"></span>
                            		</div>
                            		<div class="two">
                            			<span class="title">开始年份</span>
	                					<span class="content" v-text="plan.planBeginTime"></span>
	                					<span class="title">截止年份</span>
	                					<span class="content" v-text="plan.planEndTime"></span>
                            		</div>
                					<div class="two">
                						<span class="title">编制单位</span>
	                					<span class="content" v-text="plan.compileUnit"></span>
	                					<span class="title">编制人</span>
	                    				<span class="content" v-text="plan.compilePerson"></span>
                					</div>
                					<div class="two">
                						<span class="title">编制时间</span>
	                					<span class="content" v-text="plan.compileTime"></span>
	                					<span class="title">所属全市规划</span>
	                    				<span class="content" v-text="plan.belongPlanDesc"></span>
                					</div>
                					<div class="one">
                						<span class="title">上传附件</span>
                        				<div class="content">
                        					<a href="" class="mr20">长沙市2019年全市交通监控系统升级.pdf</a>
                        					<a href="" class="mr20">长沙市2019年全市交通监控系统升级.pdf</a>
                        				</div>
                					</div>
                					
                					<div class="one">
                						<span class="title">备注</span>
                        				<div class="content" v-text="plan.remark"></div>
                					</div>
                            	</div>
                            </div>
                            
                            <div class="box mt30 edit-mode">
                            	<div class="box-title"><span>审核专项编制规划</span></div>
                            	<div class="mt20 f14">
                            		<div class="two">
                            			<span class="title">审核人</span>
	                					<div class="content">
	                						<input type="text" id="auditPerson" class="form-control" placeholder="请输入审核人"/>
	                					</div>
	                        			<span class="title">审核时间</span>
	                					<div class="content">
	                						<div class="input-group">
												<input type="text" class="form-control" placeholder="请选择审核时间" id="auditTime">
											</div>
	                					</div>
                					</div>
	                					
                            		<div class="two">
                            			<span class="title">审核结果</span>
	                					<div class="content">
	                						<select class="form-control" id="auditResult">
												<option value='' disabled selected class='none'>审核结果</option>
												<option value="3">通过</option>
		                                        <option value="4">不通过</option>
		                                    </select>
	                					</div>
                            		</div>
                            		
                            		<div class="one">
                						<span class="title">上传附件</span>
                        				<div class="content">
                        					<input type="file" class="filestyle" data-input="false" id="filestyle-1" tabindex="-1" style="position: absolute; clip: rect(0px, 0px, 0px, 0px);">
                        					<div class="bootstrap-filestyle input-group">
                        						<span class="group-span-filestyle" tabindex="0">
                        							<label for="filestyle-1" class="btn btn-white ">
                        							<span class="icon-cloud-upload"></span> 
                        							<span class="buttonText">选择上传文件</span></label>
                        						</span>
                        					</div>
                        					<p class="f12 c999 mt3">只能上传jpg/png/word/pdf/zip/excle/ppt格式文件，文件不能超过50MB</p>
                        					<div class="mt10 pb5">
	                        					<a href="" class="mr20">长沙市2019年全市交通监控系统升级.pdf</a>
	                        					<a href="" class="mr20">长沙市2019年全市交通监控系统升级.pdf</a>
	                        				</div>
                        				</div>
                					</div>
                					
                					<div class="one">
                						<span class="title">审核意见</span>
                        				<div class="content">
                        					<textarea name="" id="auditOpinion" class="form-control" placeholder="请输入审定意见（0/200）" rows="" cols=""></textarea>
                        				</div>
                					</div>
                            	</div>
                            </div>
                            
                            <div class="tc mt40 pb30">
                            	<button type="button" class="btn btn-white f12"> 取消 </button>
                            	<button type="button" class="btn btn-primary f12" onclick="modifyPlan()"> 提交 </button>
                            </div>
                            
							
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	

<script type="text/javascript">
    $('#special').addClass('active');

    var statusPlanObj = {
        '1' : '草稿',
        '2' : '待审核',
        '3' : '审核通过',
        '4' : '审核未通过'
    }

    var planId = $.getUrlParam("id");

    var appPage = new Vue({
        el : '#app',
        data : {
            plan : {}
        },
        created : function() {
            loadPlanDetail();
        },
        computed : {

        },
        methods : {
            planStatusDesc : function (val) {
                return statusPlanObj[val];
            },
            submitPlan : function () {
                this.plan.currentState = 2;
                processSavePlan(this.plan);
            }

        }
    })
	
	function modifyPlan() {
        var paramObject = {
            'auditPerson' : $('#auditPerson').val(),
            'auditTime' : $('#auditTime').val(),
            'auditResult' : $('#auditResult').val() == 3 ? 1 : 2,
            'currentState' : $('#auditResult').val(),
            'auditOpinion' : $('#auditOpinion').val(),
			'planId' : planId
		}

        $.ajax({
            'url' : contentPath + '/CityAndSpecialPlan/update',
            'dataType' : 'json',
            'type' : 'post',
            'contentType':'application/json',
            'data' : JSON.stringify(paramObject),
            'success' : function (result) {
                if (result.code != 1000) {
                    alert(result.msg);
                    if (result.code == 5555) {
                        window.location.href = '/';
                    }
                    return;
                }

                appPage.$message({
                    message: currentState == 1 ? '保存成功' : '提交成功',
                    type: 'success'
                });

                window.location.href = contentPath + '/view/specialPlan';
            },
            'error' : function (result) {
            }
        });

    }

    function loadPlanDetail() {
        $.ajax({
            'url' : contentPath + '/CityAndSpecialPlan/getOne',
            'dataType' : 'json',
            'type' : 'get',
            'data' : {
                id : planId
            },
            'success' : function (result) {
                if (result.code != 1000) {
                    alert(result.message);
                    return;
                }

                appPage.plan = result.data;
            },
            'error' : function (result) {
            }
        });
    }




	$('#auditTime').fdatepicker({format: 'yyyy-mm-dd'});

</script>
</body>
</html>
